@extends('layout.adminlayout')
@section('css')
<script src="/admin/js/metisMenu.min.js"></script>
<script src="/admin/js/custom.js"></script>
<link href="/admin/css/custom.css" rel="stylesheet">

{{--时间范围--}}
<link rel="stylesheet" href="/layui/css/layui.css"  media="all">
<script src="/layui/layui.js" charset="utf-8"></script>
{{--时间范围--}}

@endsection
@section('content')
<div class="tables">
	<div class="table-responsive bs-example widget-shadow">
		<h4>全部消息 :</h4>
		<form action="/admin/log/index" method="get">
			<div class="row" style="padding-bottom: 15px;margin-top: 0px;">
				<div class="layui-form-pane" style="margin-top: 15px;">
					<div class="layui-form-item">
						<label class="layui-form-label">代理商</label>
						<div class="layui-input-inline">
							<select name="ag" class="layui-input">
								<option value="">请选择代理商</option>
								@foreach($agent as $v)
									<option value="{{$v['id']}}"
											@if($get['ag'] == $v['id'])
											selected
											@else
											@if(Cookie::get('agentId') == $v['id'])
											selected
											@endif
											@endif>{!! $v['agent_name'] !!}</option>
								@endforeach
							</select>
						</div>
						<label class="layui-form-label">DevEUI</label>
						<div class="layui-input-inline">
							<input type="text" name="eui" value="{{$get['eui']}}" class="layui-input"/>
						</div>
						<label class="layui-form-label">编号</label>
						<div class="layui-input-inline">
							<input type="text" name="num" value="{{$get['num']}}" class="layui-input"/>
						</div>
						<label class="layui-form-label">时间</label>
						<div class="layui-input-inline">
							<input class="layui-input" placeholder="开始日" id="LAY_demorange_s" name="start" value="{{date('Y-m-d H:i:s',$get['start'])}}" >
						</div>
						<div class="layui-input-inline">
							<input class="layui-input" placeholder="截止日" id="LAY_demorange_e" name="end" value="{{date('Y-m-d H:i:s',$get['end'])}}" >
						</div>
						<label class="layui-form-label">类型</label>
						<div class="layui-input-inline">
							<input type="text" name="genre" value="{{$get['genre']}}" class="layui-input"/>
						</div>
						<div class="">
							<input type="submit" class="layui-input" style="padding: 0px; border: 0; background: #4F52BA;width: 50px; margin: 0px 10px;color:#fff" >
						</div>
					</div>
				</div>
				{{--<input type="submit" value="搜索" class="col-lg-1 col-md-1 col-sm-1 col-xs-1"  style="height: 30px; line-height: 32px; padding: 0px; border: 0; background: #4F52BA;width: 50px; margin: 0px 10px;color:#fff"/>--}}
			</div>
		</form>
		<div id="box">
			<table class="table table-bordered">
				<thead>
	 				<tr>
						<th>时间</th>
						<th>设备编号</th>
						<th>DevEUI</th>
						<th>区域</th>
						<th>建筑</th>
						<th>房间</th>
						<th>位置</th>
						<th>应用</th>
						<th>报警类型</th>
						<th>温度</th>
						<th>信号</th>
						<th>状态</th>
					</tr>
				</thead>
				<tbody class="lg_msg">
					@if(!null==$data)
						@foreach($data as $v)
							<tr>
								<th scope="row">{{date('Y-m-d H:i:s',$v['lg_time'])}}</th>
								<td>{{$v['lg_num']}}</td>
								<td><a href="/admin/device?&ag={{$get['ag']}}&eui={{$v['lg_eui']}}&tp={{$v['lg_Type']}}">{{$v['lg_eui']}}</a></td>
								<td>{{$v['lg_a_name']}}</td>
								<td>{{$v['lg_b_name']}}</td>
								<td>{{$v['lg_r_name']}}</td>
								<td>{{$v['lg_location']}}</td>
								<td>{{$v['lg_Type']}}</td>
								<td>{{$v['lg_genre']}}</td>
								<td>{{$v['lg_degree']}}<strong>℃</strong></td>
								<td>{{$v['lg_lsnr']}}</td>
								<td>@if($v['lg_status'] == 1)布防@else撤防@endif</td>
							</tr>
						@endforeach
					@endif
				</tbody> 
			</table>
		</div>
		@if(!null == $data)
			<div style="float:right;">
				{!! $data->appends($request)->render() !!}
			</div>
		@endif
	</div>
</div>
@endsection
@section('lastjs')
<script src="http://cdn.bootcss.com/socket.io/1.3.7/socket.io.js"></script>
<script src="/admin/js/logMessage.js"></script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        var start = {
            min: '2000-06-16 23:59:59'
            ,max: laydate.now()
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: '2000-06-16 23:59:59'
            ,max: laydate.now()
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function(){
            end.elem = this
            laydate(end);
        }

    });
</script>
@endsection